﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Tradex.ComponentModel;
using Tradex.Messages;

namespace Tradex.Trading {

    /// <summary>
    /// A Trade is a logical grouping of Orders and Executions in one account and in one
    /// instrument. Trades can form a hierarchy (in that one Trade consists of subtrades - possibly
    /// in other instruments). Trades allow a logical analysis of more complex operations,
    /// like straddles, where part will always result in a loss.
    /// </summary>
    public sealed class Trade : KeyedObject<TradeKey> {

        /// <summary>
        /// Constructor taking the Key as argument.
        /// </summary>
        /// <param name="tradeKey"></param>
        public Trade(TradeKey tradeKey) : base (tradeKey) {
        }

        /// <summary>
        /// The key of the parent trade.
        /// </summary>
        public TradeKey ParentTrade { get; private set; }

        /// <summary>
        /// The (semi-static) Info of the trade.
        /// </summary>
        public TradeInfo Info { get; private set; }

        /// <summary>
        /// The (dynamic) update of the trade.
        /// </summary>
        public TradeUpdate Update { get; private set; }
        
    }
}
